<?php
	session_start();
	mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
	mysql_select_db("sapmenet_users");
	$action=$_POST['action'];
	if ($_SESSION['JID']!=$_SESSION['id'])
	{
		$user=mysql_query("SELECT concat(FirstName,' ',LastName) AS FullName FROM users WHERE id={$_SESSION['JID']}");
		$userName=mysql_result($user, 0);
		$text="<a href=http://sapme.net/Framework/profilePage.php?id=".$_SESSION['JID'].">".$userName."</a> ".$action." you!";
		mysql_query("INSERT INTO notifications (text, userID) VALUES ('".$text."', {$_SESSION['id']})");
	}
	else
	{
		$text="You ".$action." yourself!";
		mysql_query("INSERT INTO notifications (text, userID) VALUES ('".$text."', {$_SESSION['id']})");
	}
?>
